﻿using System;
using System.Collections.Generic;

namespace Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{
    /// <summary>
    /// ServiceImplementation.Translator.BusinessEntityToDataContract Class - GrupoContabil
    /// </summary>
    public class GrupoContabil
    {
        #region ToGrupoContabilResponse

        public DataContract.Response.GrupoContabilResponse ToGrupoContabilResponse(BusinessEntity.GrupoContabil from)
        {
            if (from == null) return null;

            return new DataContract.Response.GrupoContabilResponse
            {
                Codigo = from.Codigo,
                Descricao = from.Descricao
            };
        }

        public List<DataContract.Response.GrupoContabilResponse> ToGrupoContabilResponse(List<BusinessEntity.GrupoContabil> from)
        {
            if (from == null) return null;

            List<DataContract.Response.GrupoContabilResponse> response = new List<DataContract.Response.GrupoContabilResponse>();

            foreach (BusinessEntity.GrupoContabil item in from)
            {
                response.Add(new DataContract.Response.GrupoContabilResponse
                {
                    Codigo = item.Codigo,
                    Descricao = item.Descricao
                });
            }
            return response;
        }

        #endregion
    }
}
